package com.hs.telepass.controller;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class PullingService extends Service {

    public static final String ACTION = "com.sun.service.PollingService";
    public static final String TAG_ID = "com.sun.service.tag.id";

    private Context mContext;

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onCreate() {
        mContext = this;
    }

    @Override
    public void onStart(Intent intent, int startId) {
        if(null == intent)
            return;

        Bundle bundle = intent.getExtras();
        HashMap<Integer, String> map = (HashMap<Integer, String>) bundle.getSerializable(TAG_ID);
        if(null == map)
            return;

        Iterator iter = map.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry entry = (Map.Entry) iter.next();
            Integer key = (Integer) entry.getKey();
            String id = (String) entry.getValue();
//            if(!StringUtil.isEmpty(id))
//                TaskController.getInstance().fetchCredentail(mContext, id, key);
        }

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        System.out.println("Service:onDestroy");
    }

}
